package com.ahui.handler.file;


import com.ahui.constant.SupportedFileTypeConst;
import com.ahui.handler.FileHandler;
import com.ahui.handler.FileHandlerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

@Slf4j
@Component
public class ImgHandler implements FileHandler {


    @Override
    public void afterPropertiesSet() {
        FileHandlerFactory.register(SupportedFileTypeConst.PNG, this);
        FileHandlerFactory.register(SupportedFileTypeConst.JPG, this);
        FileHandlerFactory.register(SupportedFileTypeConst.JPEG, this);
    }


    @Override
    public List<String> handleFile(String filePath, String tempFolder) {
        return Collections.singletonList(filePath);
    }
}
